﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DownloadProgressChangedEventArgs = System.Deployment.Application.DownloadProgressChangedEventArgs;

namespace basic
{
    public partial class startform : Form
    {
        public startform()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //stroutput.AppendText("Launching Citrix");
            Process.Start("https://apps.na.novartis.net/Citrix/Apps/auth/login.aspx");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //stroutput.AppendText("Launching Remedy");
            Process.Start("https://www.itsmnovb1.unisys.com/arsys/shared/login.jsp?/arsys/home");

        }

        private void button3_Click(object sender, EventArgs e)
        {
            //stroutput.AppendText("Launching cheat sheet");
            Process.Start("http://cnet.unisys.com/sites/6285125/NASDT/Wiki/Agent%20Cheat%20Sheet.aspx");

        }

        private void button4_Click(object sender, EventArgs e)
        {
            WebClient webClient = new WebClient();
            CredentialCache mycache = new CredentialCache();
            webClient.Credentials = new NetworkCredential("koenadam", "Sk1pp3r1!");
            webClient.DownloadProgressChanged += ProgressChanged;
            webClient.DownloadFileCompleted += Completed;
            webClient.DownloadFileAsync(new Uri("http://cnet.unisys.com/sites/6090735/MAW/Helpfiles%20output/Novartis_BMC_Remedy_7.6.chm"), @"Novartis_BMC_Remedy_7.6.chm");
        }

        private void ProgressChanged(object sender, System.Net.DownloadProgressChangedEventArgs e)
        {
           progressBar1.Value = e.ProgressPercentage; 
            //throw new NotImplementedException();
        }

        //private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        //{
            
        //}

        private void Completed(object sender, AsyncCompletedEventArgs e)
        {
            MessageBox.Show("Download completed!");
            progressBar1.Update();
            Process.Start("Novartis_BMC_Remedy_7.6.chm");
        }
        }
    }
